package cn.tedu.boot101.controller;

import cn.tedu.boot101.entity.Class;
import cn.tedu.boot101.entity.Student;
import cn.tedu.boot101.mapper.StudentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/student/")
public class StudentController {
    @Autowired
    StudentMapper sm;

    @RequestMapping("selectByCid")
    public List<Student> select(int id) {
        return sm.selectByCid(id);
    }

    @RequestMapping("insert")
    public void insert(@RequestBody Student s) {
        sm.insert(s);
    }

    @RequestMapping("delete")
    public void delete(int id) {
        sm.deleteById(id);
    }
}
